package com.ssy.lingxi.order.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * 发货记录关联的商品
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-16
 */
@Entity
@Table(schema = "public", name = "ord_delivery_product", indexes = {@Index(name = "ord_delivery_product_order_id_idx", columnList = "orderId"), @Index(name = "ord_delivery_product_batch_no_idx", columnList = "batchNo")})
public class OrderDeliveryProductDO implements Serializable {
    private static final long serialVersionUID = 7303890160705425339L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_delivery_product_seq")
    @SequenceGenerator(sequenceName = "ord_delivery_product_seq", name = "ord_delivery_product_seq", allocationSize = 1)
    private Long id;

    /**
     * 订单Id
     */
    @Column
    private Long orderId;

    /**
     * 订单商品Id，即OrderProductDO的Id
     */
    @Column
    private Long orderProductId;

    /**
     * 发货批次
     */
    @Column
    private Integer batchNo;

    /**
     * 发货单号
     */
    @Column(columnDefinition = "varchar(20)")
    private String deliveryNo;

    /**
     * 商品Id
     */
    @Column
    private Long productId;

    /**
     * 商品SkuId
     */
    @Column
    private Long skuId;

    /**
     * 商品（物料）编号
     */
    @Column(columnDefinition = "varchar(30)")
    private String productNo;

    /**
     * 商品名称
     */
    @Column(columnDefinition = "varchar(100)")
    private String name;

    /**
     * 商品品类
     */
    @Column(columnDefinition = "varchar(50)")
    private String category;

    /**
     * 商品品牌
     */
    @Column(columnDefinition = "varchar(50)")
    private String brand;

    /**
     * 商品规格
     */
    @Column(columnDefinition = "varchar(255)")
    private String spec;

    /**
     * 计价单位
     */
    @Column(columnDefinition = "varchar(10)")
    private String unit;

    /**
     * 商品单价
     */
    @Column(columnDefinition = "numeric(15,3)")
    private BigDecimal price;

    /**
     * 商品到手价
     */
    @Column(columnDefinition = "numeric(15,3)")
    private BigDecimal refPrice;

    /**
     * 税率（百分比转换的小数）
     */
    @Column(columnDefinition = "numeric(8,4)")
    private BigDecimal taxRate;

    /**
     * 关联报价商品Id
     */
    @Column
    private Long quotedProductId;

    /**
     * 关联报价商品的SkuId
     */
    @Column
    private Long quotedSkuId;

    /**
     * 关联报价商品的编号
     */
    @Column(columnDefinition = "varchar(30)")
    private String quotedProductNo;

    /**
     * 关联报价商品名称
     */
    @Column(columnDefinition = "varchar(100)")
    private String quotedName;

    /**
     * 关联报价商品品类
     */
    @Column(columnDefinition = "varchar(50)")
    private String quotedCategory;

    /**
     * 关联报价商品品牌
     */
    @Column(columnDefinition = "varchar(50)")
    private String quotedBrand;

    /**
     * 关联报价商品规格
     */
    @Column(columnDefinition = "varchar(255)")
    private String quotedSpec;

    /**
     * 采购数量
     */
    @Column(columnDefinition = "numeric(15,4)")
    private BigDecimal quantity;

    /**
     * 已发货数量
     */
    @Column(columnDefinition = "numeric(15,4)")
    private BigDecimal delivered;

    /**
     * 已收货的数量
     */
    @Column(columnDefinition = "numeric(15,4)")
    private BigDecimal received;

    /**
     * 差异数量
     */
    @Column(columnDefinition = "numeric(15,4)")
    private BigDecimal differCount;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getOrderProductId() {
        return orderProductId;
    }

    public void setOrderProductId(Long orderProductId) {
        this.orderProductId = orderProductId;
    }

    public Integer getBatchNo() {
        return batchNo;
    }

    public void setBatchNo(Integer batchNo) {
        this.batchNo = batchNo;
    }

    public String getDeliveryNo() {
        return deliveryNo;
    }

    public void setDeliveryNo(String deliveryNo) {
        this.deliveryNo = deliveryNo;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public String getProductNo() {
        return productNo;
    }

    public void setProductNo(String productNo) {
        this.productNo = productNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getRefPrice() {
        return refPrice;
    }

    public void setRefPrice(BigDecimal refPrice) {
        this.refPrice = refPrice;
    }

    public BigDecimal getTaxRate() {
        return taxRate;
    }

    public void setTaxRate(BigDecimal taxRate) {
        this.taxRate = taxRate;
    }

    public Long getQuotedProductId() {
        return quotedProductId;
    }

    public void setQuotedProductId(Long quotedProductId) {
        this.quotedProductId = quotedProductId;
    }

    public Long getQuotedSkuId() {
        return quotedSkuId;
    }

    public void setQuotedSkuId(Long quotedSkuId) {
        this.quotedSkuId = quotedSkuId;
    }

    public String getQuotedProductNo() {
        return quotedProductNo;
    }

    public void setQuotedProductNo(String quotedProductNo) {
        this.quotedProductNo = quotedProductNo;
    }

    public String getQuotedName() {
        return quotedName;
    }

    public void setQuotedName(String quotedName) {
        this.quotedName = quotedName;
    }

    public String getQuotedCategory() {
        return quotedCategory;
    }

    public void setQuotedCategory(String quotedCategory) {
        this.quotedCategory = quotedCategory;
    }

    public String getQuotedBrand() {
        return quotedBrand;
    }

    public void setQuotedBrand(String quotedBrand) {
        this.quotedBrand = quotedBrand;
    }

    public String getQuotedSpec() {
        return quotedSpec;
    }

    public void setQuotedSpec(String quotedSpec) {
        this.quotedSpec = quotedSpec;
    }

    public BigDecimal getQuantity() {
        return quantity;
    }

    public void setQuantity(BigDecimal quantity) {
        this.quantity = quantity;
    }

    public BigDecimal getDelivered() {
        return delivered;
    }

    public void setDelivered(BigDecimal delivered) {
        this.delivered = delivered;
    }

    public BigDecimal getReceived() {
        return received;
    }

    public void setReceived(BigDecimal received) {
        this.received = received;
    }

    public BigDecimal getDifferCount() {
        return differCount;
    }

    public void setDifferCount(BigDecimal differCount) {
        this.differCount = differCount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        OrderDeliveryProductDO that = (OrderDeliveryProductDO) o;
        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
